package org.wechat4j.api.datacube;

import org.wechat4j.utils.Https;


/**
 * @author bjliuyong
 * @version 1.0
 * @created date 16-11-18
 */
abstract  class DataCubeBaseService {

    /***
     * 获取统计分析数据
     * @param beginDate
     * @param endDate
     * @param accessToken
     * @param interfaceName
     * @return
     */
    protected static String getData(String beginDate ,String endDate , String accessToken ,String interfaceName)  {
        String requestUrl = "https://api.weixin.qq.com/datacube/" + interfaceName + "?access_token=" + accessToken;

        /**
         * {
         *  "begin_date": "2014-12-02",
         *  "end_date": "2014-12-07"
         * }
         */

        String jsonData  = "{\"begin_date\":\"" + beginDate+ "\",\"end_date\":\"" +endDate+ "\"}";
        return Https.post(requestUrl ,jsonData , null) ;
    }

}
